home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / xcmd / xrulesde.sit / Xrules™ Demo / card_12387.txt < prev    next >
Encoding:
Text File  |  1991-06-24  |  3.3 KB  |  93 lines

  1. -- card: 12387 from stack: in
  2. -- bmap block id: 12545
  3. -- flags: 4000
  4. -- background id: 7992
  5. -- name: Xrules Rule Base
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 01
  10. -- high flags: 0007
  11. -- rect: left=2 top=24 right=311 bottom=510
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 22
  16. -- text size: 10
  17. -- style flags: 0
  18. -- line height: 13
  19. -- part name: 
  20.  
  21.  
  22. -- part 3 (button)
  23. -- low flags: 00
  24. -- high flags: 0000
  25. -- rect: left=256 top=314 right=337 bottom=281
  26. -- title width / last selected line: 0
  27. -- icon id / first selected line: 1013 / 1013
  28. -- text alignment: 1
  29. -- font id: 0
  30. -- text size: 12
  31. -- style flags: 0
  32. -- line height: 16
  33. -- part name: Next
  34. ----- HyperTalk script -----
  35. on mouseUp
  36.   go to next card
  37. end mouseUp
  38.  
  39.  
  40.  
  41. -- part contents for card part 1
  42. ----- text -----
  43. The Xrules system is a rule based system.  It uses "if-then" production rules and facts to represent knowledge.  In addition to rules and facts, you may also declare and use HyperTalk globals in the rule base.  As you will see, the language for the rule base is very similar to HyperTalk. 
  44.  
  45. In the following discussions, we will use a simple Backus-Naur Form (BNF) to describe the language constructs.  The following defines the notational conventions that will be used for the BNF:
  46.  
  47.        -  items in all caps represent keywords (GLOBAL, FACT, etc.)
  48.  
  49.        -  items in all small letters represent some string or 
  50.           construct (operand, fact_id, conditionals, etc.).
  51.  
  52.   |    -  indicates either-or of items on either side of the bar
  53.  
  54.   { }  -  items within the braces may be repeated 0 to n times
  55.  
  56.   [ ]  -  items within the brackets are optional
  57.  
  58. Keywords and special characters may not be used as identifiers or strings unless they are enclosed in quotation marks (quotation marks may not be used in quoted strings other than to delimit the string).  The keywords are:
  59.  
  60.          AND   CARD   DAEMON   ELSE   END
  61.          FACT  FALSE  GLOBAL   GO     IF
  62.          INTO  NOT    OR       PUT    RULE
  63.          THEN  TO     TRUE     WHEN
  64.  
  65. Special characters used by Xrules include:
  66.  
  67.     equal sign (=)   quotation marks (")   comma (,) 
  68.     period (.)       pound sign (#)        asterisk (*) 
  69.     minus (-)        left parentheses (()  right parentheses ())
  70.     space ( )        question mark (?)     left angle bracket (<)
  71.     right angle bracket (>)
  72.  
  73. Other characters permitted in quoted strings and identifiers include:
  74.  
  75.     exclamation mark (!)     at sign (@)         dollar sign ($)
  76.     percent (%)              up flex (^)         ampersand (&)
  77.     plus (+)                 left brace ({)      right brace (})
  78.     left bracket ([)         right bracket (])   bar (|)
  79.     colon (:)                semicolon (;)       single quote (')
  80.     slash (/)                tilde (~)
  81.  
  82. Characters permitted in strings and identifiers without quotes include the following:
  83.  
  84.   Upper and lower case alpha characters
  85.   Numerals (as long as they are not the first character in the string or    
  86.           identifier)
  87.   The underscore (_) character
  88.  
  89. In the BNF, strings without quotes are referred to as "simple_string". Quoted strings are referred to as "quoted_string".
  90.  
  91. Control characters such as tab and carriage return and characters not mentioned above may not be used in strings or identifiers whether quoted or not.
  92.  
  93.